package com.lvhengchang.interceptor;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lvhengchang.pojo.Result;

import jakarta.servlet.http.HttpServletRequest;

@ControllerAdvice
@ResponseBody
public class GlobalExceptionHandler {
	@ExceptionHandler(value = Exception.class)
	public Result<?> exceptionHandler(HttpServletRequest request, Exception e) {
		return Result.fail(500, e.getMessage());
		}
}
